import { GraphNode } from "./base";
import { GraphNodeLayout } from "../graph_node_layout";
import { LinkNodeNext, LinkNodeNumberEntry, LinkNodeNumberOutput, LinkNodeObjectEntry, LinkNodeObjectOutput} from "../link_node";
import { Text } from "../element/Element";
// Vector3
export class Vector3 extends GraphNode {
    static alias = "矢量3";
    variableName_: any;
    variableValue_: any;
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const x = this.linkNode_input(graphNodeLayout,"x",LinkNodeNumberEntry,"x");
            left.appendChild(x.linearLayout);

            const y = this.linkNode_input(graphNodeLayout,"y",LinkNodeNumberEntry,"y");
            left.appendChild(y.linearLayout);

            const z = this.linkNode_input(graphNodeLayout,"z",LinkNodeNumberEntry,"z");
            left.appendChild(z.linearLayout);
        });

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getData() {
        return {
            ...super.getData(),
            variableName: this.variableName,
            variableValue: this.variableValue,
        }
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"vector3",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["x","y","z"],map);

        return index;
    }
}

// Vector2
export class Vector2 extends GraphNode {
    static alias = "矢量2";
    variableName_: any;
    variableValue_: any;
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const x = this.linkNode_input(graphNodeLayout,"x",LinkNodeNumberEntry,"x");
            left.appendChild(x.linearLayout);

            const y = this.linkNode_input(graphNodeLayout,"y",LinkNodeNumberEntry,"y");
            left.appendChild(y.linearLayout);
        });

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getData() {
        return {
            ...super.getData(),
            variableName: this.variableName,
            variableValue: this.variableValue,
        }
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"vector2",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["x","y"],map);

        return index;
    }
}

export class Scene extends GraphNode {
    static alias = "场景";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();
        left.appendChild(new Text("scene").setFontSize("12px"));
        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"scene",
            uuid: this.uuid,
        }

        map.push(token);
        return {index,linkNodeAlias};
    }

}
 
// 透视相机 fov?: number, aspect?: number, near?: number, far?: number
export class PerspectiveCamera extends GraphNode {
    static alias = "透视相机";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const fov = this.linkNode_input(graphNodeLayout,"fov",LinkNodeNumberEntry,"fov");
            left.appendChild(fov.linearLayout);

            const aspect = this.linkNode_input(graphNodeLayout,"aspect",LinkNodeNumberEntry,"aspect");
            left.appendChild(aspect.linearLayout);

            const near = this.linkNode_input(graphNodeLayout,"near",LinkNodeNumberEntry,"near");
            left.appendChild(near.linearLayout);

            const far = this.linkNode_input(graphNodeLayout,"far",LinkNodeNumberEntry,"far");
            left.appendChild(far.linearLayout);
        });

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"perspectiveCamera",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["fov","aspect","near","far"],map);

        return index;
    }

}

// 渲染器
export class WebGLRenderer extends GraphNode {
    static alias = "渲染器";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();
        left.appendChild(new Text("WebGLRenderer").setFontSize("12px"));
        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"webGLRenderer",
            uuid: this.uuid,
        }

        map.push(token);
        return {index,linkNodeAlias};
    }

}

// 环境光
export class AmbientLight extends GraphNode {
    static alias = "环境光";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        left.selfAuto(() => {
            const color = this.linkNode_input(graphNodeLayout,"color",LinkNodeObjectEntry,"color");
            left.appendChild(color.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"ambientLight",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["color"],map);
        return {index,linkNodeAlias};
    }

}

// 平行光
export class DirectionalLight extends GraphNode {
    static alias = "平行光";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        left.selfAuto(() => {
            const color = this.linkNode_input(graphNodeLayout,"color",LinkNodeObjectEntry,"color");
            left.appendChild(color.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"directionalLight",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["color"],map);
        return {index,linkNodeAlias};
    }

}

// 时钟
export class Clock extends GraphNode {
    static alias = "时钟";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();
        left.appendChild(new Text("Clock").setFontSize("12px"));
        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"clock",
            uuid: this.uuid,
        }

        map.push(token);
        return {index,linkNodeAlias};
    }

}

// 颜色
export class Color extends GraphNode {
    static alias = "颜色";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        right.selfAuto(() => {
            const color = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"outputColor");
            right.appendChild(color.linearLayout);
        });

        left.selfAuto(() => {
            const color = this.linkNode_input(graphNodeLayout,"color",LinkNodeObjectEntry,"color");
            left.appendChild(color.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"color",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["color"],map);
        return {index,linkNodeAlias};
    }

}

// 坐标系
export class AxesHelper extends GraphNode {
    static alias = "坐标系";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        left.selfAuto(() => {
            const x = this.linkNode_input(graphNodeLayout,"x",LinkNodeObjectEntry,"x");
            left.appendChild(x.linearLayout);

            const y = this.linkNode_input(graphNodeLayout,"y",LinkNodeObjectEntry,"y");
            left.appendChild(y.linearLayout);

            const z = this.linkNode_input(graphNodeLayout,"z",LinkNodeObjectEntry,"z");
            left.appendChild(z.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"axesHelper",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["x","y","z"],map);

        return index;
    }

}

// Lambert材质
export class MeshLambertMaterial extends GraphNode {
    static alias = "Lambert材质";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const color = this.linkNode_input(graphNodeLayout,"color",LinkNodeNumberEntry,"color");
            left.appendChild(color.linearLayout);

            const side = this.linkNode_input(graphNodeLayout,"side",LinkNodeNumberEntry,"side");
            left.appendChild(side.linearLayout);

            const map = this.linkNode_input(graphNodeLayout,"map",LinkNodeNumberEntry,"map");
            left.appendChild(map.linearLayout);
        });

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"meshLambertMaterial",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["color","side","map"],map);
        return index;
    }
}

// 高光材质 
export class MeshPhongMaterial extends GraphNode {
    static alias = "高光材质";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const color = this.linkNode_input(graphNodeLayout,"color",LinkNodeNumberEntry,"color");
            left.appendChild(color.linearLayout);

            const side = this.linkNode_input(graphNodeLayout,"side",LinkNodeNumberEntry,"side");
            left.appendChild(side.linearLayout);

            const map = this.linkNode_input(graphNodeLayout,"map",LinkNodeNumberEntry,"map");
            left.appendChild(map.linearLayout);
        });

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"meshPhongMaterial",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["color","side","map"],map);
        return index;
    }

}

// 雾 color: any, near?: number, far?: number
export class Fog extends GraphNode {
    static alias = "雾";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const color = this.linkNode_input(graphNodeLayout,"color",LinkNodeNumberEntry,"color");
            left.appendChild(color.linearLayout);

            const near = this.linkNode_input(graphNodeLayout,"near",LinkNodeNumberEntry,"near");
            left.appendChild(near.linearLayout);

            const map = this.linkNode_input(graphNodeLayout,"far",LinkNodeNumberEntry,"far");
            left.appendChild(map.linearLayout);
        });

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"fog",
            uuid: this.uuid,
        }

        map.push(token);
        this.entryNodeTemplate(token,["color","near","far"],map);
        return {index,linkNodeAlias};
    }
}

// 网格 
export class Mesh extends GraphNode {
    static alias = "网格";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const geometry = this.linkNode_input(graphNodeLayout,"几何体",LinkNodeObjectEntry,"geometry");
            left.appendChild(geometry.linearLayout);

            const material = this.linkNode_input(graphNodeLayout,"材质",LinkNodeObjectEntry,"material");
            left.appendChild(material.linearLayout);
        });

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"mesh",
            uuid: this.uuid,
        }

        map.push(token);
        this.entryNodeTemplate(token,["geometry","material"],map);
        return {index,linkNodeAlias};
    }

}

// 线 
export class Line extends GraphNode {
    static alias = "线";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const geometry = this.linkNode_input(graphNodeLayout,"几何体",LinkNodeObjectEntry,"geometry");
            left.appendChild(geometry.linearLayout);

            const material = this.linkNode_input(graphNodeLayout,"材质",LinkNodeObjectEntry,"material");
            left.appendChild(material.linearLayout);
        });

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"line",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["geometry","material"],map);

        return {index,linkNodeAlias};
    }
}

// 网格 width?: number, height?: number, depth?: number, widthSegments?: number, heightSegments?: number, depthSegments?: number
export class BoxGeometry extends GraphNode {
    static alias = "长方体几何体";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const width = this.linkNode_input(graphNodeLayout,"width",LinkNodeNumberEntry,"width");
            left.appendChild(width.linearLayout);

            const height = this.linkNode_input(graphNodeLayout,"height",LinkNodeNumberEntry,"height");
            left.appendChild(height.linearLayout);

            const depth = this.linkNode_input(graphNodeLayout,"depth",LinkNodeNumberEntry,"depth");
            left.appendChild(depth.linearLayout);

            const widthSegments = this.linkNode_input(graphNodeLayout,"widthSegments",LinkNodeNumberEntry,"widthSegments");
            left.appendChild(widthSegments.linearLayout);

            const heightSegments = this.linkNode_input(graphNodeLayout,"heightSegments",LinkNodeNumberEntry,"heightSegments");
            left.appendChild(heightSegments.linearLayout);

            const depthSegments = this.linkNode_input(graphNodeLayout,"depthSegments",LinkNodeNumberEntry,"depthSegments");
            left.appendChild(depthSegments.linearLayout);
        });

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"boxGeometry",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["width","height","depth","widthSegments","heightSegments","depthSegments"],map);

        return {index,linkNodeAlias};
    }

}

export class AddMesh extends GraphNode {
    static alias = "添加3d对象";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint();

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);

            const mesh = this.linkNode_input(graphNodeLayout,"网格",LinkNodeObjectEntry,"mesh");
            left.appendChild(mesh.linearLayout);
        });

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeObjectOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"addMesh",
            uuid: this.uuid,
            next: null
        }

        map.push(token);

        this.entryNodeTemplate(token,["target","mesh"],map);
        token.next = this.outputNode("next",map);

        return index;
    }
}

export class ClockAnimationFrame extends GraphNode {
    static alias = "时钟动画";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint();

        const { container, left, right } = this.container_left_right();

        right.selfAuto(() => {
            const nextTimeBody = this.text_linkNode(graphNodeLayout,"动画体",LinkNodeNext,"nextTimeBody");
            right.appendChild(nextTimeBody.linearLayout);

            const delta = this.text_linkNode(graphNodeLayout,"delta",LinkNodeNumberOutput,"delta");
            right.appendChild(delta.linearLayout);
            delta.linearLayout.setStyle({"margin-top":"10px"});

            // const flag = this.text_linkNode(graphNodeLayout,"标志",LinkNodeNumberOutput,"flag");
            // right.appendChild(flag.linearLayout);
            
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"clockAnimationFrame",
            uuid: this.uuid,
            next: null,
        }

        map.push(token);

        this.outputNodeTemplate(token,["nextTimeBody"],map);
        token.next = this.outputNode("next",map);

        return index;
    }
}

// 
export class Aspect extends GraphNode {
    static alias = "Aspect";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);
        });

        right.selfAuto(() => {
            const result = this.text_linkNode(graphNodeLayout,"",LinkNodeNumberOutput,"result");
            right.appendChild(result.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"aspect",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["target"],map);

        return index;
    }
}

export class Render extends GraphNode {
    static alias = "渲染";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint();

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);

            const scene = this.linkNode_input(graphNodeLayout,"场景",LinkNodeObjectEntry,"scene");
            left.appendChild(scene.linearLayout);

            const mesh = this.linkNode_input(graphNodeLayout,"相机",LinkNodeObjectEntry,"camera");
            left.appendChild(mesh.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"render",
            uuid: this.uuid,
            next: null,
        }

        map.push(token);

        this.entryNodeTemplate(token,["target","scene","camera"],map);

        token.next = this.outputNode("next",map);

        return index;
    }

}

export class SetSize extends GraphNode {
    static alias = "设置绘图大小";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint();

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);

            const x = this.linkNode_input(graphNodeLayout,"width",LinkNodeNumberEntry,"width");
            left.appendChild(x.linearLayout);
            const y = this.linkNode_input(graphNodeLayout,"height",LinkNodeNumberEntry,"height");
            left.appendChild(y.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"setSize",
            uuid: this.uuid,
            next: null
        }

        map.push(token);

        this.entryNodeTemplate(token,["target","width","height"],map);
        token.next = this.outputNode("next",map);

        return {index,linkNodeAlias};
    }

}

export class LookAt extends GraphNode {
    static alias = "相机朝向";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint();

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const camera = this.linkNode_input(graphNodeLayout,"相机",LinkNodeObjectEntry,"camera");
            left.appendChild(camera.linearLayout);

            const x = this.linkNode_input(graphNodeLayout,"x",LinkNodeNumberEntry,"x");
            left.appendChild(x.linearLayout);
            const y = this.linkNode_input(graphNodeLayout,"y",LinkNodeNumberEntry,"y");
            left.appendChild(y.linearLayout);
            const z = this.linkNode_input(graphNodeLayout,"z",LinkNodeNumberEntry,"z");
            left.appendChild(z.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"lookAt",
            uuid: this.uuid,
            next: null,
        }

        map.push(token);

        this.entryNodeTemplate(token,["camera","x","y","z"],map);
        token.next = this.outputNode("next",map);

        return index;
    }

}

export class SetVector2 extends GraphNode {
    static alias = "设置矢量2";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint();

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);

            const x = this.linkNode_input(graphNodeLayout,"x",LinkNodeNumberEntry,"x");
            left.appendChild(x.linearLayout);
            const y = this.linkNode_input(graphNodeLayout,"y",LinkNodeNumberEntry,"y");
            left.appendChild(y.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"setVector2",
            uuid: this.uuid,
            next: null
        }

        map.push(token);

        this.entryNodeTemplate(token,["target","x","y"],map);
        token.next = this.outputNode("next",map);

        return {index,linkNodeAlias};
    }

}

export class SetVector3 extends GraphNode {
    static alias = "设置矢量3";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint();

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);

            const x = this.linkNode_input(graphNodeLayout,"x",LinkNodeNumberEntry,"x");
            left.appendChild(x.linearLayout);
            const y = this.linkNode_input(graphNodeLayout,"y",LinkNodeNumberEntry,"y");
            left.appendChild(y.linearLayout);
            const z = this.linkNode_input(graphNodeLayout,"z",LinkNodeNumberEntry,"z");
            left.appendChild(z.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"setVector3",
            uuid: this.uuid,
            next: null
        }

        map.push(token);

        this.entryNodeTemplate(token,["target","x","y","z"],map);
        token.next = this.outputNode("next",map);

        return index;
    }
}

export class GetVector3 extends GraphNode {
    static alias = "获取矢量3";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);
        });

        right.selfAuto(() => {

            const x = this.text_linkNode(graphNodeLayout,"x",LinkNodeNumberOutput,"x");
            right.appendChild(x.linearLayout);
            const y = this.text_linkNode(graphNodeLayout,"y",LinkNodeNumberOutput,"y");
            right.appendChild(y.linearLayout);
            const z = this.text_linkNode(graphNodeLayout,"z",LinkNodeNumberOutput,"z");
            right.appendChild(z.linearLayout);
        });



        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"getVector3",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["target"],map);

        return {index,linkNodeAlias};
    }

}

export class GetVector2 extends GraphNode {
    static alias = "获取矢量2";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);
        });

        right.selfAuto(() => {

            const x = this.text_linkNode(graphNodeLayout,"x",LinkNodeNumberOutput,"x");
            right.appendChild(x.linearLayout);
            const y = this.text_linkNode(graphNodeLayout,"y",LinkNodeNumberOutput,"y");
            right.appendChild(y.linearLayout);
        });



        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"getVector2",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["target"],map);

        return {index,linkNodeAlias};
    }
}

/**
 * 
 */
export class SetPosition extends GraphNode {
    static alias = "设置位置";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint();

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);

            const x = this.linkNode_input(graphNodeLayout,"x",LinkNodeNumberEntry,"x");
            left.appendChild(x.linearLayout);
            const y = this.linkNode_input(graphNodeLayout,"y",LinkNodeNumberEntry,"y");
            left.appendChild(y.linearLayout);
            const z = this.linkNode_input(graphNodeLayout,"z",LinkNodeNumberEntry,"z");
            left.appendChild(z.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"setPosition",
            uuid: this.uuid,
            next: null
        }

        map.push(token);

        this.entryNodeTemplate(token,["target","x","y","z"],map);
        token.next = this.outputNode("next",map);

        return index;
    }

}

export class SetRotation extends GraphNode {
    static alias = "设置旋转";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint();

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);

            const x = this.linkNode_input(graphNodeLayout,"x",LinkNodeNumberEntry,"x");
            left.appendChild(x.linearLayout);
            const y = this.linkNode_input(graphNodeLayout,"y",LinkNodeNumberEntry,"y");
            left.appendChild(y.linearLayout);
            const z = this.linkNode_input(graphNodeLayout,"z",LinkNodeNumberEntry,"z");
            left.appendChild(z.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"setRotation",
            uuid: this.uuid,
            next: null
        }

        map.push(token);

        this.entryNodeTemplate(token,["target","x","y","z"],map);
        token.next = this.outputNode("next",map);

        return index;
    }

}

export class SetScale extends GraphNode {
    static alias = "设置大小";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint();

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);

            const x = this.linkNode_input(graphNodeLayout,"x",LinkNodeNumberEntry,"x");
            left.appendChild(x.linearLayout);
            const y = this.linkNode_input(graphNodeLayout,"y",LinkNodeNumberEntry,"y");
            left.appendChild(y.linearLayout);
            const z = this.linkNode_input(graphNodeLayout,"z",LinkNodeNumberEntry,"z");
            left.appendChild(z.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"setScale",
            uuid: this.uuid,
            next: null
        }

        map.push(token);

        this.entryNodeTemplate(token,["target","x","y","z"],map);
        token.next = this.outputNode("next",map);

        return index;
    }

}

export class GetPosition extends GraphNode {
    static alias = "获取位置";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);
        });

        right.selfAuto(() => {

            const x = this.text_linkNode(graphNodeLayout,"x",LinkNodeNumberOutput,"x");
            right.appendChild(x.linearLayout);
            const y = this.text_linkNode(graphNodeLayout,"y",LinkNodeNumberOutput,"y");
            right.appendChild(y.linearLayout);
            const z = this.text_linkNode(graphNodeLayout,"z",LinkNodeNumberOutput,"z");
            right.appendChild(z.linearLayout);
        });



        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"getPosition",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["target"],map);

        return {index,linkNodeAlias};
    }
}

export class GetRotation extends GraphNode {
    static alias = "获取旋转";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);
        });

        right.selfAuto(() => {

            const x = this.text_linkNode(graphNodeLayout,"x",LinkNodeNumberOutput,"x");
            right.appendChild(x.linearLayout);
            const y = this.text_linkNode(graphNodeLayout,"y",LinkNodeNumberOutput,"y");
            right.appendChild(y.linearLayout);
            const z = this.text_linkNode(graphNodeLayout,"z",LinkNodeNumberOutput,"z");
            right.appendChild(z.linearLayout);
        });



        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"getRotation",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["target"],map);

        return {index,linkNodeAlias};
    }

}

export class GetScale extends GraphNode {
    static alias = "获取缩放";
    constructor(graphNodeLayout: GraphNodeLayout) {
        super(graphNodeLayout);

        this.initTitle_LinkPoint(false,false);

        const { container, left, right } = this.container_left_right();

        left.selfAuto(() => {
            const target = this.linkNode_input(graphNodeLayout,"目标",LinkNodeObjectEntry,"target");
            left.appendChild(target.linearLayout);
        });

        right.selfAuto(() => {

            const x = this.text_linkNode(graphNodeLayout,"x",LinkNodeNumberOutput,"x");
            right.appendChild(x.linearLayout);
            const y = this.text_linkNode(graphNodeLayout,"y",LinkNodeNumberOutput,"y");
            right.appendChild(y.linearLayout);
            const z = this.text_linkNode(graphNodeLayout,"z",LinkNodeNumberOutput,"z");
            right.appendChild(z.linearLayout);
        });

        this.appendChild(container);
    }

    getToken(map: any[],linkNodeAlias="") {
        const index = super.getToken(map);

        const token = {
            type:"getScale",
            uuid: this.uuid,
        }

        map.push(token);

        this.entryNodeTemplate(token,["target"],map);

        return {index,linkNodeAlias};
    }

}

/*

*/